Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

179
Visualizações
"type": "module" import issue

Using js librairies, I struggle with the fact that require and import are not suitable together. When I write "type": "module" in the package.json, then import works but require doesn't, and when I don't, the opposite happens. I don't get how to import both of the two librairies.

I import fs like this :

const fs = require('fs')

and in the other file I am importing PythonShell like this :

import { PythonShell } from 'python-shell'

Is there a way to have "type" : "module" only applying for one librairy in my package.json ? Or can I import one like the other in order to use only one key word (import or require) ?

Thank you, have a great day.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You don't necessarily need to use import to use the PythonShell class from python-shell, you can just use require() so your code would look like this

const fs = require('fs');
const PythonShell = require('python-shell').PythonShell;

// ...
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda